package com.ylc.test;

import com.ylc.proxy5.AOP.TransAOP;
import com.ylc.proxy5.ProxyFactory;
import com.ylc.proxy5.Service.ProductServiceImpl;
import com.ylc.proxy5.Service.Service;
import com.ylc.proxy5.AOP.LogAOP;
import org.junit.Test;


/**
 * @Author: ylc
 * @Description: 使用动态代理优化业务和切面的解耦合。
 * @Date Created in 2022-07-18 15:20
 */
public class MyTest05 {
    @Test
    public void test05(){
        //得到代理对象
        Service agent = (Service) ProxyFactory.getAgent(new ProductServiceImpl(),new TransAOP());
        Service agent1 = (Service) ProxyFactory.getAgent(agent,new LogAOP());
        agent1.buy();
    }
}
